home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5226 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  42 lines

  1. Path: sun001.spd.dsccc.com!spd!jmccarty
  2. From: jmccarty@spd.dsccc.com (Mike McCarty)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Where Can I Find Standard C Library S
  5. Date: 9 Feb 1996 00:33:13 GMT
  6. Organization: DSC Communications Corporation, Plano, Texas USA
  7. Message-ID: <4fe4o9$h9d@sun001.spd.dsccc.com>
  8. References: <4fb8mf$ouo@spanky.pls.ov.com> <4fb90l$ouo@spanky.pls.ov.com> <3119E6D9.60FD@cmt.lpr.mail.carel.fi>
  9. NNTP-Posting-Host: aplo139.spd.dsccc.com
  10.  
  11. In article <3119E6D9.60FD@cmt.lpr.mail.carel.fi>,
  12. Ari Lukumies  <aril@cmt.lpr.mail.carel.fi> wrote:
  13. )Fletcher.Glenn@ov.com wrote:
  14. )> 
  15. )> 
  16. )> Whoops! for strcpy:
  17. )> 
  18. )> char *strcpy(char *destination, char *source)
  19. )> {
  20. )>     char *retval;
  21. )> 
  22. )>     retval = destination;
  23. )>     while((*destination++ = *source++) != '\0');
  24. )>     return(retval);
  25. )> }
  26. )>                         Fletcher.Glenn@ov.com
  27. )
  28. )... And you wonder why printf("%s\n", strcpy(tmp, "thingyam")); may not give correct 
  29. )results using your strcpy version... Try this for size:
  30.  
  31. [alternate strcpy() (also not ANSI comformant) deleted]
  32.  
  33. )This will also copy the nul-terminator. :)
  34.  
  35. So does Ari's code.
  36.  
  37. Mike
  38. ----
  39. char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
  40.  
  41. I don't speak for DSC.         <- They make me say that.
  42.